namespace FineCollection.Intf
{

    /// <summary>
    /// Associative array, a map of a <i>key</i> to a <i>value</i>.
    /// </summary>
    /// <typeparam name="K">type of key.</typeparam>
    /// <typeparam name="V">type of value (associated object).</typeparam>
    public interface RMap<K,V>
        where K : System.IEquatable<K>
    {
        
        /// <summary>
        /// Associative indexator (read only).
        /// Allows to get <c>value</c> by the specified <c>key</c>.
        /// </summary>
        /// <param name="key">key to look for.</param>
        /// <returns>found value, or <i>default</i> if not found.</returns>
        V this[K key]
        {
            get;
        }
        
        
        /// <summary>
        /// Count of elements in the list.
        /// </summary>
        int Count
        {
            get;
        }


        /// <summary>
        /// Checks whether the collection is empty.
        /// </summary>
        bool IsEmpty
        {
            get;
        }


        /// <summary>
        /// Checks whether the collection has at least one element.
        /// </summary>
        bool IsNotEmpty
        {
            get;
        }


        /// <summary>
        /// Checks whether this map contains the specified key.
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        bool ContainsKey(K key);


        /// <summary>
        /// Returns all entries as an array.
        /// </summary>
        /// <returns>array with all entries, or an empty array if the map is enpty.</returns>
        MapEntry<K,V>[] ListAllEntries();

        
        /// <summary>
        /// Represents the map as a set of entries.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method returns a view of the map, not a copy of data. When the map's data
        /// are changed, the changes are visible in this view. 
        /// </para>
        /// <para>
        /// The complexity of this method is not dependent on how many entries are stored
        /// in the map. This method just returns a view object linked to the map.
        /// </para>
        /// <para>
        /// The view is read only.
        /// </para>
        /// </remarks>
        /// <returns>a read only view of the map entries.</returns>
        //RSet<MapEntry<K,V>> EntriesView();
        
    }
    
    
}
